package com.ruoyi.system.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.system.api.domain.SysRegion;
import com.ruoyi.system.service.ISysRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

@RestController
@RequestMapping("/region")
public class SysRegionController extends BaseController {

	@Autowired
	private ISysRegionService sysRegionService;
	
	/**
	 * 查询所有区域
	 */
	@GetMapping("/list")
	@ResponseBody
	public TableDataInfo list(SysRegion sysRegion) {
		List<SysRegion> list = sysRegionService.list(sysRegion);
		return getDataTable(list);
	}

	/**
	 * 根据区域id集合获得的区域数据
	 * @param ids   区域id集合
	 * @return  区域数据
	 */
	@GetMapping("/getListByIds")
	public List<SysRegion> regionInfo(@RequestParam(value = "ids") Set<String> ids) {
		return sysRegionService.getListByIds(ids);
	}
}
